<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<div style="margin-top: 5px; margin-bottom: 15px">
	<h2 style="display: inline"><s:text name="checklist.header"/></h2>
	<div style="float: right">
		<!-- Neues Item --> 
		<s:if test="#session.loginToken.rights.contains('create_checklist_item')">
		<s:url id="createUrlId" action="createChecklistItemInput" namespace="/">
			<s:param name="eventId" value="%{eventId}"></s:param>
		</s:url>
		<s:a href="%{createUrlId}" title="%{getText('checklist.create')}">
			<img src="image/icons/0009_add.png" width="24" height="24"
				alt="profile" border="0">
		</s:a>
		</s:if>
	</div>
</div>



<table class="green">
	<thead>
		<tr>
			<th><s:text name="checklist.item"></s:text></th>
			<th><s:text name="checklist.creator"></s:text></th>
			<th><s:text name="checklist.status"></s:text></th>
			<th><s:text name="checklist.actions"></s:text></th>
		</tr>
	</thead>
	<tbody>
		<s:iterator value="checklistItems">
			<tr>
				<td><s:property value="name"/></td>
				<td><s:property value="ersteller.email"/></td>
				<td>
					<s:if test="erfueller == null">
						<%-- Link "erfuellen" mit Icon "rot" anzeigen --%>
						<s:url action="fulfillChecklistItem" namespace="/" var="fulfillUrlId">
							<s:param name="checklistItemId" value="id"/>
							<s:param name="updateMode">fulfill</s:param>
							<s:param name="eventId" value="eventId" />
						</s:url>
						<s:a href="%{fulfillUrlId}" title="%{getText('checklist.fulfill')}">
							<img src="image/icons/0006_cross.png" width="24" height="24" border="0" alt="fulfill"></img>
						</s:a>
					</s:if><s:else>
						<%-- Link "nicht mehr erfuellt" mit Icon "grün" anzeigen --%>
						<s:url action="fulfillChecklistItem" namespace="/" var="unfulfillUrlId">
							<s:param name="checklistItemId" value="id"/>
							<s:param name="updateMode">unfulfill</s:param>
							<s:param name="eventId" value="eventId" />
						</s:url>
						<s:a href="%{unfulfillUrlId}" title="%{getText('checklist.unfulfill')}">
							<img src="image/icons/0007_tick.png" width="24" height="24" border="0" alt="unfulfill"></img>
						</s:a>					
					</s:else>				
				</td>
				<td>
					<!-- Ansehen -->
					<s:url action="showChecklistItem" namespace="/" var="showUrlId">
							<s:param name="checklistItemId" value="id"/>
						</s:url>
						<s:a href="%{showUrlId}" title="%{getText('checklist.show')}">
							<img src="image/icons/0047_id.png" width="24" height="24" border="0" alt="show"></img>
					</s:a>	
					<!-- Bearbeiten -->
					<s:url action="editChecklistItemInput" namespace="/" var="editUrlId">
							<s:param name="checklistItemId" value="id"/>
							<s:param name="eventId" value="%{eventId}"/>
						</s:url>
						<s:a href="%{editUrlId}" title="%{getText('checklist.edit')}">
							<img src="image/icons/0037_notepad.png" width="24" height="24" border="0" alt="edit"></img>
					</s:a>	
					<!-- Löschen -->
					<s:url action="deleteChecklistItem" namespace="/" var="deleteUrlId">
							<s:param name="checklistItemId" value="id"/>
						</s:url>
						<s:a href="%{deleteUrlId}" title="%{getText('checklist.delete')}">
							<img src="image/icons/0049_trash.png" width="24" height="24" border="0" alt="delete"></img>
						</s:a>	
				</td>
			</tr>
		</s:iterator>
	</tbody>
</table>
